#include<iostream>
#include<vector>
using namespace std;
long long int gcd(long long a, long long int b)
{
    long long int t;
    while (b != 0)
    {
        t = b;
        b = a % b;
        a = t;
    }
    return a;
}
int main()
{
    int n;
    cin >> n;
    vector<long long int>a(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    long long sum = a[0], min;
    for (int i = 1; i < n; i++)
    {
        sum = gcd(sum, a[i]);
    }
    min = sum * n;
    cout << min;
}